﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace FoodManager
{
    public class UserLogin
    {
        public string Username { get; set; }
        public byte TrangThai { get; set; }
        bool isLogin = false;
        public int Id { get; set; }
        public bool IsLogin
        {
            get { return isLogin; }
        }
        public bool Login(string username,string password)
        {
            db.tblusersDataTable user = new db.tblusersDataTable();
            dbTableAdapters.tblusersTableAdapter da = new dbTableAdapters.tblusersTableAdapter();
            da.Login(user,username,password);
            this.Id = 0;
            if (user.Rows.Count > 0)
            {
                this.Username = user[0].username;
                this.TrangThai = user[0].trangthai;
                this.isLogin = true;
                this.Id = user[0].id;
                return true;
            }
            return false;
        }
    }
}
